package com.demo.sys.service.mpl;


import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;

import com.demo.sys.dao.ClientUserDao;
import com.demo.sys.entity.ClientUserEntity;
import com.demo.sys.entity.ResponseUserInfoEntity;
import com.demo.sys.entity.UserEntity;
import com.demo.sys.service.ClientUserService;

import common.constant.Constants;
import common.utils.msg.RespData;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import javax.servlet.http.HttpServletRequest;

@Service("clientUserService")
public class ClientUserServiceImpl extends ServiceImpl<ClientUserDao, ClientUserEntity> implements ClientUserService {
    @Autowired
    private HttpServletRequest request;


    /**
     * 用户基本信息
     *
     * @return
     */
    @Override
    public ResponseUserInfoEntity userInfo() {
        String userId = request.getAttribute(Constants.TOKEN_USER_ID).toString();
        
        return baseMapper.userInfo(userId);
    }

    @Override
    public RespData<UserEntity> userLogin(String account, String password) {
        return baseMapper.userLogin(account, password);
    }

}
